package com.captjack.core.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * @author Capt Jack
 * @date 2018/5/21
 */
public class HelloValidator extends Validator {

    /**
     * HelloValidator错误key
     */
    private static final String HELLO_RETURN_STATUS_KEY = "1001";

    @Override
    protected void validate(Controller controller) {
        validateRequiredString("msg", HELLO_RETURN_STATUS_KEY, "msg不能为空！");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.renderText(controller.getAttrForStr(HELLO_RETURN_STATUS_KEY));
    }

}
